<!DOCTYPE html>
<html lang="zh-cn" xmlns:v-on="http://www.w3.org/1999/xhtml">
    <head>
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type"/>
        <meta content="IE=edge" http-equiv="X-UA-Compatible">
        <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" name="viewport"/>
        <meta content="webkit" name="renderer">
        <title>后台管理中心</title>
        <link href="/css/pintuer.css" rel="stylesheet">
        <link href="/css/admin.css" rel="stylesheet">
        <script src="/js/jquery.js"></script>
        <script type="text/javascript" src="/js/axios.min.js"></script>
        <script type="text/javascript" src="/js/vue.js"></script>
    </head>
    <body style="background-color:#f2f9fd;">
        <div id="admin">
            <div class="header bg-main" id="adminId">
                <div class="logo margin-big-left fadein-top">
                    <h1><a href="info" target="right">
                        <span class="icon-caret-right"></span>
                        <img alt="" class="radius-circle rotate-hover" height="50" src="/images/y.jpg"/></a>
                        <span>{{adminAccount}}</span>
                    </h1>
                </div>
                <div class="head-l">
                    <a class="button button-little bg-green" href="" target="_blank">
                        <span class="icon-home"></span>
                        前台首页
                    </a> &nbsp;&nbsp;&nbsp;&nbsp;
                    <a class="button button-little bg-red" v-on:click="logout">
                        <span class="icon-power-off"></span>
                        退出登录
                    </a>
                    <p class="msg" style="color: red"></p>
                </div>
            </div>
            <div class="leftnav">
                <div class="leftnav-title"><strong><span class="icon-list"></span>菜单列表</strong></div>
                <h2><span class="icon-user"></span>管理员中心</h2>
                <ul>
                    <li><a href="/backStage/info" target="right"><span class="icon-caret-right"></span>个人信息</a></li>
                    <li><a href="/backStage/pass" target="right"><span class="icon-caret-right"></span>安全管理</a></li>
                    <li><a href="/backStage/page" target="right"><span class="icon-caret-right"></span>用户权限管理</a></li>
                </ul>
                <h2><span class="icon-pencil-square-o"></span>商品管理</h2>
                <ul>
                    <li><a href="/backStage/list" target="right"><span class="icon-caret-right"></span>查询商品</a></li>
                    <li><a href="/backStage/add" target="right"><span class="icon-caret-right"></span>添加商品</a></li>
                    <li><a href="/backStage/cate" target="right"><span class="icon-caret-right"></span>分类管理</a></li>
                </ul>
                <h2><span class="icon-pencil-square-o"></span>订单管理</h2>
                <ul>
                    <li><a href="/backStage/all" target="right"><span class="icon-caret-right"></span>全部订单</a></li>
                    <li><a href="/backStage/pay" target="right"><span class="icon-caret-right"></span>待付款订单</a></li>
                    <li><a href="/backStage/take" target="right"><span class="icon-caret-right"></span>待收货订单</a></li>
                    <li><a href="/backStage/finish" target="right"><span class="icon-caret-right"></span>已完成订单</a></li>
                </ul>
            </div>
        </div>
            <script type="text/javascript">
                $(function () {
                    $(".leftnav h2").click(function () {
                        $(this).next().slideToggle(200);
                        $(this).toggleClass("on");

                    })
                    $(".leftnav ul li a").click(function () {
                        $("#a_leader_txt").text($(this).text());
                        $(".leftnav ul li a").removeClass("on");
                        $(this).addClass("on");
                    })
                });
            </script>
            <ul class="bread">
                <li><a class="icon-home" href="{:U('Index/info')}" target="right"> 首页</a></li>
                <li><a href="##" id="a_leader_txt">网站信息</a></li>
            </ul>
            <div class="admin">
                <iframe height="100%" name="right" rameborder="0" scrolling="auto" width="100%"></iframe>
            </div>
            <div style="text-align:center;">

            </div>

        <script>
            var vue = new Vue({
                el: "#admin",
                data: {
                    adminAccount: ""
                },
                methods: {
                    showName: function () {
                        let url = "/admin/showName";
                        axios.get(url)
                            .then(function (result) {
                                let adminAccount = result.data.adminAccount;
                                this.vue.adminAccount = adminAccount;
                            })
                            .catch();
                    },
                    logout:function () {
                        let url = "/admin/logout";
                        axios.get(url)
                            .then(function (result) {
                                if (result.data.status==200){
                                    var result = confirm("确定要退出吗？");
                                    if(result){
                                        window.location.href="/login";
                                    }
                                }else {
                                    $(".msg").html(result.data.msg);
                                }
                            })
                            .catch();
                    }
                },
                mounted: function () {
                    this.showName();
                }
            })
        </script>
    </body>
</html>